<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Education
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
?>


<?php if ($this->paginator->getTotalItemCount()): ?>

  <?php $this->headScript()->appendFile('application/modules/Radcodes/externals/scripts/slideshow.js') ?>
  
  <div class="education_featured_educations">
    <div class="education_featured_mask">
      <div id="<?php echo $this->widget_name?>" class="education_featured_slides">
        <?php foreach ($this->paginator as $education): ?>
          <div class="education_featured_slide education_record_<?php echo $education->getIdentity();?>">
            <?php if ($this->showphoto && $education->photo_id): ?>
              <div class="education_photo">
                <?php echo $this->htmlLink($education->getHref(), $this->itemPhoto($education, 'thumb.profile')); ?>
              </div>
            <?php endif;?>
            <div class="education_content">
              <div class="education_title"><h3><?php echo $education->__toString()?></h3></div>
              <?php if ($this->showdetails): ?>
                <div class="education_details">
                  <div class="education_details_type">
                    <?php echo $this->htmlLink($education->getCategory()->getHref(), $this->translate($education->getCategory()->getTitle())); ?>
                    <?php if ($education->degree): ?>
                      <?php echo $education->degree; ?>
                    <?php endif;?>
                    <?php if ($education->class_year): ?>
                      <?php echo $education->class_year; ?>
                    <?php endif;?>
        
                  </div>
                  <?php if ($education->concentration || $education->minor): ?>
                  <div class="education_details_focus">
                    <?php if ($education->concentration): ?>
                      <span class="education_concentration">+ <?php echo $education->concentration; ?></span>
                    <?php endif;?>
                    <?php if ($education->minor): ?>
                      <span class="education_minor">- <?php echo $education->minor; ?></span>
                    <?php endif;?>
                  </div>
                  <?php endif;?>
                </div>
              <?php endif; ?>
              <?php if ($this->showmeta): ?>
                <div class="education_meta">
                  <?php echo $this->translate('Posted by %1$s on %2$s', $education->getOwner()->__toString(), $this->timestamp(strtotime($education->creation_date))) ?></span>
                  <br />
                  <?php echo $this->translate(array("%s comment", "%s comments", $education->comment_count), $this->locale()->toNumber($education->comment_count)); ?>
                  -
                  <?php echo $this->translate(array('%1$s like', '%1$s likes', $education->like_count), $this->locale()->toNumber($education->like_count)); ?>
                  -
                  <?php echo $this->translate(array('%s view', '%s views', $education->view_count), $this->locale()->toNumber($education->view_count)); ?>
                </div>
              <?php endif;?>
              <?php if (false && $this->showdescription && $education->getDescription()): ?>
                <div class="education_description">
                  <?php echo $this->viewMore($education->getDescription()); ?>
                </div>
              <?php endif;?>
            </div>  
          </div>  
        <?php endforeach; ?>  
      </div>
    </div>
    <?php if ($this->use_slideshow): ?>
      <p class="radcodes_slideshow_buttons" id="<?php echo $this->widget_name?>_buttons">
        <span id="<?php echo $this->widget_name?>_prev" class="radcodes_slideshow_button_prev"><span><?php echo $this->translate('&lt;&lt; Previous'); ?></span></span>
        <span id="<?php echo $this->widget_name?>_play" class="radcodes_slideshow_button_play"><span><?php echo $this->translate('Play &gt;'); ?></span></span>
        <span id="<?php echo $this->widget_name?>_stop" class="radcodes_slideshow_button_stop"><span><?php echo $this->translate('Stop'); ?></span></span>
        <span id="<?php echo $this->widget_name?>_next" class="radcodes_slideshow_button_next"><span><?php echo $this->translate('Next &gt;&gt;'); ?></span></span>
      </p>
    <?php endif; ?>
  </div>
  <?php if ($this->use_slideshow): ?>
    <script type="text/javascript">
    en4.core.runonce.add(function(){
      var <?php echo $this->widget_name?>_width = $('<?php echo $this->widget_name?>').getSize().x;
      
      $$('#<?php echo $this->widget_name?> div.education_featured_slide').each(function(el){
        el.setStyle('width', <?php echo $this->widget_name?>_width - 30);
      });
    	var <?php echo $this->widget_name?> = new radcodesNoobSlide({
    		box: $('<?php echo $this->widget_name?>'),
    		items: $$('#<?php echo $this->widget_name?> div.education_featured_slide'),
    		size: <?php echo $this->widget_name?>_width,
    		autoPlay: true,
    		interval: 8000,
    		addButtons: {
    			previous: $('<?php echo $this->widget_name?>_prev'),
    			play: $('<?php echo $this->widget_name?>_play'),
    			stop: $('<?php echo $this->widget_name?>_stop'),
    			next: $('<?php echo $this->widget_name?>_next')
    		},
    		onWalk: function(currentItem,currentHandle){
    		}
    	});
    });
    </script>
  <?php endif; ?>

<?php else: ?>
  <div class="tip">
    <span>
      <?php echo $this->translate('There are no featured educations.');?>
    </span>
  </div>
<?php endif; ?>
